import { createRouter, createWebHistory } from 'vue-router'

const Index = () => import("@/views/index/Index.vue")
const Recommend = () => import("@/views/recommend/Recommend.vue")
const RankingList = () => import("@/views/rankinglist/RankingList.vue")
const SongList = () => import("@/views/songlist/SongList.vue")
const Singer = () => import("@/views/singer/Singer.vue")
const SingerHome = () => import("@/views/singer/child/SingerHome.vue")
const SingerDetail = () => import("@/views/singer/child/SingerDetail.vue")
const PlayList = () => import("@/views/playlist/PlayList.vue")
const NewDisc = () => import("@/views/newdisc/NewDisc.vue")
const NewDiscHome = () => import("@/views/newdisc/child/NewDiscHome.vue")
const NewDiscDetail = () => import("@/views/newdisc/child/NewDiscDetail.vue")
const Lyric = () => import("@/views/lyric/Lyric.vue")

const routes = [

  {
    path: "/",
    redirect: "/recommend",
    component: Index,
    children: [
      {
        path: "/recommend",
        component: Recommend
      },
      {
        path: "/rankinglist",
        component: RankingList
      },
      {
        path: "/songlist",
        component: SongList
      },
      {
        path: "/singer",
        component: Singer,
        redirect: "/singer/home",
        children: [
          {
            path: "/singer/home",
            component: SingerHome,
          },
          {
            path: "/singer/detail",
            component: SingerDetail
          }
        ]
      },
      {
        path: "/newdisc",
        component: NewDisc,
        redirect: "/newdisc/home",
        children: [
          {
            path: "/newdisc/home",
            component: NewDiscHome
          },
          {
            path: "/newdisc/detail",
            component: NewDiscDetail
          }
        ]
      }
    ]
  },
  {
    path: "/playlist",
    name: "PlayList",
    component: PlayList
  },
  {
    path: "/lyric",
    component: Lyric
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
